<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>overload</title>
    <link rel="stylesheet" href="../src/core/qunit.css">
    <script>
    var _globalError;
    window.onerror = function (error) {
      _globalError = error;
      // Cancel, don't report to browser and grunt-contrib-qunit
      return true;
    };
    </script>
    <script src="../qunit/qunit.js"></script>
    <!-- Load twice -->
    <script src="../qunit/qunit.js"></script>
    <script>
    QUnit.module('overload', function () {
      QUnit.test('detect', function (assert) {
        assert.true(
          // In Firefox the string starts with "Error: "
          // In Chrome the string starts with "Uncaught Error: "
          _globalError.includes('QUnit has already been defined.'),
          'error is thrown if QUnit global was overloaded'
        );
      });
    });
    </script>
  </head>
  <body>
    <div id="qunit"></div>
  </body>
</html>
